<template>
  <div>
    <el-form
      class="input-form"
      label-position="right"
      label-width="120px"
      ref="editForm"
      :rules="propRules"
      :disabled="propReadonly"
      :model="form"
    >
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="评价类型" prop="appraiseType">
            <el-select v-model="form.appraiseType" filterable>
              <el-option value>请选择</el-option>
              <el-option
                v-for="dict in utils.getDictDataList('appraise_type')"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="评价分数" prop="score">
            <el-input-number v-model="form.score" :precision="1" :min="0" :max="100" :controls="false" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="下限" prop="appraiseLow">
            <el-input-number v-model="form.appraiseLow" :precision="1" :min="0" :max="100" :controls="false" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="上限" prop="appraiseHigh">
            <el-input-number v-model="form.appraiseHigh" :precision="1" :min="0" :max="1000" :controls="false" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {},
      viewData: {}
    }
  },
  methods: {},
  created() {
    let that = this
    this.$emit('event-register', {
      validate: callback => {
        this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        if (this.form.appraiseLow > this.form.appraiseHigh) {
          this.utilMessage.warning('上限不能低于下限')
          return
        }
        return true
      },
      afterMove: (formData, initData) => {
        this.form = global.utils.jsonClone(formData)
        
        // 设置switch 元素默认值
      },
      afterSave: () => {},
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {},
      beforeFlow: flowButtonKey => {
        return true
      },
      afterFlow: flowButtonKey => {},
      beforeClose: () => {
        return true
      }
    })
  },
  props: {
    propParent: Object,
    propInitData: Object,
    propPrimaryKey: String,
    propDictionaries: Object,
    propCurrentRow: Object,
    propViewFormData: Object,
    propReadonly: Boolean,
    propStatus: String,
    propRules: Object
  },
  components: {},
  computed: {}
}
</script>

<style lang="scss" scoped>
.container {
  width: 100%;
  height: 100%;
}
</style>
